/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MovementFrame.java
 *
 * Created on Mar 2, 2011, 1:01:07 PM
 */

package gbbmgmt;

import java.util.*;
//import javax.swing.JOptionPane;
//import javax.swing.table.*;
import java.text.*;
//import javax.swing.JMenuItem;
//import javax.swing.JPopupMenu;
//import java.awt.event.MouseEvent;
import javax.swing.*;
//import java.awt.event.*;

/**
 *
 * @author dchapman
 */
public class MovementFrame extends javax.swing.JFrame {

    //Variables for calculations.
    public ArrayList<String[]> Brew;
    public ArrayList<String[]> Movement;
    public ArrayList<String[]> Employee;
    public ArrayList<String[]> Vessel;
    public ArrayList<String[]> Vesselold;

    public NumberFormat f = new DecimalFormat("#0.00");
    public NumberFormat f2 = new DecimalFormat("#0");
    public NumberFormat f3 = new DecimalFormat("#0.000");

    /** Creates new form MovementFrame */
    public MovementFrame() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jComboBoxBrew = new javax.swing.JComboBox();
        jLabel2 = new javax.swing.JLabel();
        jComboBoxMovement = new javax.swing.JComboBox();
        jButtonExit = new javax.swing.JButton();
        jPanelInfo = new javax.swing.JPanel();
        jDateChooser1 = new com.toedter.calendar.JDateChooser();
        jLabel4 = new javax.swing.JLabel();
        jComboBoxEmployee = new javax.swing.JComboBox();
        jLabel3 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jTextFieldTime = new javax.swing.JTextField();
        jPanelStats = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jLabelMovement = new javax.swing.JLabel();
        jLabel33 = new javax.swing.JLabel();
        jLabel34 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabelVessel2 = new javax.swing.JLabel();
        jLabelBatch = new javax.swing.JLabel();
        jLabelGrav = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabelCurVol = new javax.swing.JLabel();
        jPanelCellar = new javax.swing.JPanel();
        jLabel8 = new javax.swing.JLabel();
        jLabelVessel = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jComboBoxVessel = new javax.swing.JComboBox();
        jLabel11 = new javax.swing.JLabel();
        jTextFieldQty = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jTextFieldGrav = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        jTextFieldTemp = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jTextFieldPSI = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        jTextFieldNotes = new javax.swing.JTextField();
        jButtonLastGrav = new javax.swing.JButton();
        jLabel19 = new javax.swing.JLabel();
        jPanelBarrel = new javax.swing.JPanel();
        jLabel18 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        jTextFieldHalf = new javax.swing.JTextField();
        jTextFieldQtr = new javax.swing.JTextField();
        jTextFieldSix = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jLabel26 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        jLabel28 = new javax.swing.JLabel();
        jTextField750 = new javax.swing.JTextField();
        jTextField12 = new javax.swing.JTextField();
        jTextField22 = new javax.swing.JTextField();
        jLabel29 = new javax.swing.JLabel();
        jLabel32 = new javax.swing.JLabel();
        jLabel30 = new javax.swing.JLabel();
        jLabel31 = new javax.swing.JLabel();
        jButtonSubmit = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setName("Form"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(gbbmgmt.GBBMGMTApp.class).getContext().getResourceMap(MovementFrame.class);
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jComboBoxBrew.setName("jComboBoxBrew"); // NOI18N
        jComboBoxBrew.addPopupMenuListener(new javax.swing.event.PopupMenuListener() {
            public void popupMenuCanceled(javax.swing.event.PopupMenuEvent evt) {
            }
            public void popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {
                jComboBoxBrewPopupMenuWillBecomeInvisible(evt);
            }
            public void popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {
            }
        });

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jComboBoxMovement.setName("jComboBoxMovement"); // NOI18N
        jComboBoxMovement.addPopupMenuListener(new javax.swing.event.PopupMenuListener() {
            public void popupMenuCanceled(javax.swing.event.PopupMenuEvent evt) {
            }
            public void popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {
                jComboBoxMovementPopupMenuWillBecomeInvisible(evt);
            }
            public void popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {
            }
        });

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(gbbmgmt.GBBMGMTApp.class).getContext().getActionMap(MovementFrame.class, this);
        jButtonExit.setAction(actionMap.get("ExitMovement")); // NOI18N
        jButtonExit.setText(resourceMap.getString("jButtonExit.text")); // NOI18N
        jButtonExit.setName("jButtonExit"); // NOI18N

        jPanelInfo.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanelInfo.setName("jPanelInfo"); // NOI18N

        jDateChooser1.setName("jDateChooser1"); // NOI18N

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jComboBoxEmployee.setName("jComboBoxEmployee"); // NOI18N

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        jTextFieldTime.setText(resourceMap.getString("jTextFieldTime.text")); // NOI18N
        jTextFieldTime.setName("jTextFieldTime"); // NOI18N

        javax.swing.GroupLayout jPanelInfoLayout = new javax.swing.GroupLayout(jPanelInfo);
        jPanelInfo.setLayout(jPanelInfoLayout);
        jPanelInfoLayout.setHorizontalGroup(
            jPanelInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelInfoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelInfoLayout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jComboBoxEmployee, 0, 228, Short.MAX_VALUE))
                    .addGroup(jPanelInfoLayout.createSequentialGroup()
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldTime, javax.swing.GroupLayout.DEFAULT_SIZE, 84, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jDateChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanelInfoLayout.setVerticalGroup(
            jPanelInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelInfoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(jComboBoxEmployee, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel5)
                        .addComponent(jTextFieldTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel4))
                    .addComponent(jDateChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanelStats.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanelStats.setName("jPanelStats"); // NOI18N

        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        jLabelMovement.setText(resourceMap.getString("jLabelMovement.text")); // NOI18N
        jLabelMovement.setName("jLabelMovement"); // NOI18N

        jLabel33.setText(resourceMap.getString("jLabel33.text")); // NOI18N
        jLabel33.setName("jLabel33"); // NOI18N

        jLabel34.setText(resourceMap.getString("jLabel34.text")); // NOI18N
        jLabel34.setName("jLabel34"); // NOI18N

        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        jLabelVessel2.setText(resourceMap.getString("jLabelVessel2.text")); // NOI18N
        jLabelVessel2.setName("jLabelVessel2"); // NOI18N

        jLabelBatch.setText(resourceMap.getString("jLabelBatch.text")); // NOI18N
        jLabelBatch.setName("jLabelBatch"); // NOI18N

        jLabelGrav.setText(resourceMap.getString("jLabelGrav.text")); // NOI18N
        jLabelGrav.setName("jLabelGrav"); // NOI18N

        jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
        jLabel9.setName("jLabel9"); // NOI18N

        jLabelCurVol.setText(resourceMap.getString("jLabelCurVol.text")); // NOI18N
        jLabelCurVol.setName("jLabelCurVol"); // NOI18N

        javax.swing.GroupLayout jPanelStatsLayout = new javax.swing.GroupLayout(jPanelStats);
        jPanelStats.setLayout(jPanelStatsLayout);
        jPanelStatsLayout.setHorizontalGroup(
            jPanelStatsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelStatsLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelStatsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel9)
                    .addComponent(jLabel6)
                    .addComponent(jLabel34)
                    .addComponent(jLabel33)
                    .addComponent(jLabel7))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelStatsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelMovement)
                    .addComponent(jLabelVessel2)
                    .addComponent(jLabelBatch)
                    .addComponent(jLabelGrav)
                    .addComponent(jLabelCurVol))
                .addContainerGap(102, Short.MAX_VALUE))
        );
        jPanelStatsLayout.setVerticalGroup(
            jPanelStatsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelStatsLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelStatsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(jLabelMovement))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelStatsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel33)
                    .addComponent(jLabelBatch))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelStatsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel34)
                    .addComponent(jLabelGrav))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelStatsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(jLabelVessel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelStatsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(jLabelCurVol))
                .addContainerGap(129, Short.MAX_VALUE))
        );

        jPanelCellar.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanelCellar.setName("jPanelCellar"); // NOI18N

        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N

        jLabelVessel.setText(resourceMap.getString("jLabelVessel.text")); // NOI18N
        jLabelVessel.setName("jLabelVessel"); // NOI18N

        jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
        jLabel10.setName("jLabel10"); // NOI18N

        jComboBoxVessel.setName("jComboBoxVessel"); // NOI18N

        jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N
        jLabel11.setName("jLabel11"); // NOI18N

        jTextFieldQty.setText(resourceMap.getString("jTextFieldQty.text")); // NOI18N
        jTextFieldQty.setName("jTextFieldQty"); // NOI18N

        jLabel12.setText(resourceMap.getString("jLabel12.text")); // NOI18N
        jLabel12.setName("jLabel12"); // NOI18N

        jLabel13.setText(resourceMap.getString("jLabel13.text")); // NOI18N
        jLabel13.setName("jLabel13"); // NOI18N

        jTextFieldGrav.setText(resourceMap.getString("jTextFieldGrav.text")); // NOI18N
        jTextFieldGrav.setName("jTextFieldGrav"); // NOI18N

        jLabel14.setText(resourceMap.getString("jLabel14.text")); // NOI18N
        jLabel14.setName("jLabel14"); // NOI18N

        jTextFieldTemp.setName("jTextFieldTemp"); // NOI18N

        jLabel15.setText(resourceMap.getString("jLabel15.text")); // NOI18N
        jLabel15.setName("jLabel15"); // NOI18N

        jLabel16.setText(resourceMap.getString("jLabel16.text")); // NOI18N
        jLabel16.setName("jLabel16"); // NOI18N

        jTextFieldPSI.setName("jTextFieldPSI"); // NOI18N

        jLabel17.setText(resourceMap.getString("jLabel17.text")); // NOI18N
        jLabel17.setName("jLabel17"); // NOI18N

        jTextFieldNotes.setName("jTextFieldNotes"); // NOI18N

        jButtonLastGrav.setAction(actionMap.get("GetGrav")); // NOI18N
        jButtonLastGrav.setText(resourceMap.getString("jButtonLastGrav.text")); // NOI18N
        jButtonLastGrav.setName("jButtonLastGrav"); // NOI18N

        jLabel19.setText(resourceMap.getString("jLabel19.text")); // NOI18N
        jLabel19.setName("jLabel19"); // NOI18N

        javax.swing.GroupLayout jPanelCellarLayout = new javax.swing.GroupLayout(jPanelCellar);
        jPanelCellar.setLayout(jPanelCellarLayout);
        jPanelCellarLayout.setHorizontalGroup(
            jPanelCellarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelCellarLayout.createSequentialGroup()
                .addGroup(jPanelCellarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelCellarLayout.createSequentialGroup()
                        .addGap(2, 2, 2)
                        .addGroup(jPanelCellarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanelCellarLayout.createSequentialGroup()
                                .addGap(10, 10, 10)
                                .addComponent(jLabel8)
                                .addGap(6, 6, 6)
                                .addComponent(jLabelVessel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel10)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jComboBoxVessel, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jLabel19)))
                    .addGroup(jPanelCellarLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanelCellarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPanelCellarLayout.createSequentialGroup()
                                .addGroup(jPanelCellarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(jPanelCellarLayout.createSequentialGroup()
                                        .addComponent(jLabel14)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jTextFieldTemp, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(jPanelCellarLayout.createSequentialGroup()
                                        .addComponent(jLabel11)
                                        .addGap(4, 4, 4)
                                        .addComponent(jTextFieldQty, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelCellarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanelCellarLayout.createSequentialGroup()
                                        .addComponent(jLabel12)
                                        .addGap(30, 30, 30)
                                        .addComponent(jLabel13))
                                    .addGroup(jPanelCellarLayout.createSequentialGroup()
                                        .addComponent(jLabel15)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jLabel16)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelCellarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(jTextFieldPSI)
                                    .addComponent(jTextFieldGrav, javax.swing.GroupLayout.DEFAULT_SIZE, 74, Short.MAX_VALUE)))
                            .addGroup(jPanelCellarLayout.createSequentialGroup()
                                .addComponent(jLabel17)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTextFieldNotes)))))
                .addContainerGap(21, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelCellarLayout.createSequentialGroup()
                .addContainerGap(213, Short.MAX_VALUE)
                .addComponent(jButtonLastGrav)
                .addContainerGap())
        );

        jPanelCellarLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jTextFieldGrav, jTextFieldPSI, jTextFieldQty, jTextFieldTemp});

        jPanelCellarLayout.setVerticalGroup(
            jPanelCellarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelCellarLayout.createSequentialGroup()
                .addComponent(jLabel19)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelCellarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(jLabelVessel)
                    .addComponent(jLabel10)
                    .addComponent(jComboBoxVessel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelCellarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldQty, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12)
                    .addComponent(jLabel13)
                    .addComponent(jTextFieldGrav, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelCellarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelCellarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTextFieldPSI, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel16))
                    .addGroup(jPanelCellarLayout.createSequentialGroup()
                        .addGroup(jPanelCellarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTextFieldTemp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel15)
                            .addComponent(jLabel14))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelCellarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel17)
                            .addComponent(jTextFieldNotes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButtonLastGrav)
                .addContainerGap())
        );

        jPanelBarrel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanelBarrel.setName("jPanelBarrel"); // NOI18N

        jLabel18.setText(resourceMap.getString("jLabel18.text")); // NOI18N
        jLabel18.setName("jLabel18"); // NOI18N

        jLabel20.setText(resourceMap.getString("jLabel20.text")); // NOI18N
        jLabel20.setName("jLabel20"); // NOI18N

        jLabel21.setText(resourceMap.getString("jLabel21.text")); // NOI18N
        jLabel21.setName("jLabel21"); // NOI18N

        jLabel22.setText(resourceMap.getString("jLabel22.text")); // NOI18N
        jLabel22.setName("jLabel22"); // NOI18N

        jTextFieldHalf.setText(resourceMap.getString("jTextFieldHalf.text")); // NOI18N
        jTextFieldHalf.setName("jTextFieldHalf"); // NOI18N

        jTextFieldQtr.setName("jTextFieldQtr"); // NOI18N

        jTextFieldSix.setName("jTextFieldSix"); // NOI18N

        jLabel23.setText(resourceMap.getString("jLabel23.text")); // NOI18N
        jLabel23.setName("jLabel23"); // NOI18N

        jLabel24.setText(resourceMap.getString("jLabel24.text")); // NOI18N
        jLabel24.setName("jLabel24"); // NOI18N

        jLabel25.setText(resourceMap.getString("jLabel25.text")); // NOI18N
        jLabel25.setName("jLabel25"); // NOI18N

        javax.swing.GroupLayout jPanelBarrelLayout = new javax.swing.GroupLayout(jPanelBarrel);
        jPanelBarrel.setLayout(jPanelBarrelLayout);
        jPanelBarrelLayout.setHorizontalGroup(
            jPanelBarrelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelBarrelLayout.createSequentialGroup()
                .addGroup(jPanelBarrelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelBarrelLayout.createSequentialGroup()
                        .addGap(2, 2, 2)
                        .addComponent(jLabel18))
                    .addGroup(jPanelBarrelLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanelBarrelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanelBarrelLayout.createSequentialGroup()
                                .addComponent(jLabel22)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTextFieldSix))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanelBarrelLayout.createSequentialGroup()
                                .addComponent(jLabel20)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTextFieldHalf, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanelBarrelLayout.createSequentialGroup()
                                .addComponent(jLabel21)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTextFieldQtr)))
                        .addGroup(jPanelBarrelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanelBarrelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanelBarrelLayout.createSequentialGroup()
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel23))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelBarrelLayout.createSequentialGroup()
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel24)))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelBarrelLayout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel25)))))
                .addContainerGap(77, Short.MAX_VALUE))
        );
        jPanelBarrelLayout.setVerticalGroup(
            jPanelBarrelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelBarrelLayout.createSequentialGroup()
                .addComponent(jLabel18)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelBarrelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel20)
                    .addComponent(jTextFieldHalf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel23))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelBarrelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel21)
                    .addComponent(jTextFieldQtr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel24))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelBarrelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel22)
                    .addComponent(jTextFieldSix, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel25))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel1.setName("jPanel1"); // NOI18N

        jLabel26.setText(resourceMap.getString("jLabel26.text")); // NOI18N
        jLabel26.setName("jLabel26"); // NOI18N

        jLabel27.setText(resourceMap.getString("jLabel27.text")); // NOI18N
        jLabel27.setName("jLabel27"); // NOI18N

        jLabel28.setText(resourceMap.getString("jLabel28.text")); // NOI18N
        jLabel28.setName("jLabel28"); // NOI18N

        jTextField750.setName("jTextField750"); // NOI18N

        jTextField12.setName("jTextField12"); // NOI18N

        jTextField22.setName("jTextField22"); // NOI18N

        jLabel29.setText(resourceMap.getString("jLabel29.text")); // NOI18N
        jLabel29.setName("jLabel29"); // NOI18N

        jLabel32.setText(resourceMap.getString("jLabel32.text")); // NOI18N
        jLabel32.setName("jLabel32"); // NOI18N

        jLabel30.setText(resourceMap.getString("jLabel30.text")); // NOI18N
        jLabel30.setName("jLabel30"); // NOI18N

        jLabel31.setText(resourceMap.getString("jLabel31.text")); // NOI18N
        jLabel31.setName("jLabel31"); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel28, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel27, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel26, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jTextField22, javax.swing.GroupLayout.DEFAULT_SIZE, 102, Short.MAX_VALUE)
                            .addComponent(jTextField12)
                            .addComponent(jTextField750))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel31)
                            .addComponent(jLabel30)
                            .addComponent(jLabel29)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(2, 2, 2)
                        .addComponent(jLabel32)))
                .addContainerGap(64, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jLabel32)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel26)
                    .addComponent(jTextField22, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel29))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel27)
                    .addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel30))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel28)
                    .addComponent(jTextField750, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel31))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jButtonSubmit.setAction(actionMap.get("SubmitMovement")); // NOI18N
        jButtonSubmit.setText(resourceMap.getString("jButtonSubmit.text")); // NOI18N
        jButtonSubmit.setName("jButtonSubmit"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanelBarrel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jPanelInfo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jPanelCellar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jPanelStats, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel2)
                                    .addComponent(jLabel1))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(jComboBoxBrew, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jComboBoxMovement, javax.swing.GroupLayout.Alignment.LEADING, 0, 274, Short.MAX_VALUE))
                                .addGap(99, 99, 99)))
                        .addGap(10, 10, 10))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jButtonSubmit)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 450, Short.MAX_VALUE)
                        .addComponent(jButtonExit)
                        .addContainerGap())))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jComboBoxBrew, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jComboBoxMovement, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanelInfo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanelCellar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jPanelStats, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanelBarrel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButtonExit)
                    .addComponent(jButtonSubmit))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jComboBoxBrewPopupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_jComboBoxBrewPopupMenuWillBecomeInvisible
        // TODO add your handling code here:
        //Code should enable the movement check box and populate it with the appropriate values.
        //for given state of current brew.
        /*jComboBoxMovement.setEnabled(true);
        DBA.openDBCon();

        String st = GetState();
        
        Movement.clear();

        if (st.equals("5")){
            //Primary fermentation need to show all options except packaging.
            Movement = DBA.RunSQLQuery("SELECT StateID,StateDesc,MoveDesc FROM State WHERE StateID ='10'" +
                    " OR StateID='15' OR StateID='25'");
        }
        if (st.equals("10")){
            //Lagering need to show all options except ferm and lagering..
            Movement = DBA.RunSQLQuery("SELECT StateID,StateDesc,MoveDesc FROM State WHERE StateID > 10");
        }
        if (st.equals("15")){
            //Conditioning need to show all options greater than 15..
            Movement = DBA.RunSQLQuery("SELECT StateID,StateDesc,MoveDesc FROM State WHERE StateID > 15");
        }
        if (st.equals("25")){
            //Barrel Aging need to show options 15, 20, and 21..
            Movement = DBA.RunSQLQuery("SELECT StateID,StateDesc,MoveDesc FROM State WHERE StateID='15'" +
                    " OR StateID='20' OR StateID='21'");
        }

        jComboBoxMovement.removeAllItems();
        jComboBoxMovement.addItem("");
        for(String s[] : Movement){
            jComboBoxMovement.addItem(s[2]);
        }

        //Update the appropriate ids for current vessel.
        String vs = GetVessel();
        if(vs.equals("69")){
            jLabelVessel.setText("Barrel");
            jLabelVessel2.setText("Barrel");
        } else {
            DBA.GetFVData(vs);
            jLabelVessel.setText(DBA.FVDesg);
            jLabelVessel2.setText(DBA.FVDesg);
        }

        //Update Batch.
        jLabelBatch.setText(GetBatch());
        jLabelGrav.setText(GetLastSG(GetBatch()));
        jLabelCurVol.setText(f.format(DBA.VolLeft) + " BBL");

        DBA.closeDBCon();*/
        BrewPop();
    }//GEN-LAST:event_jComboBoxBrewPopupMenuWillBecomeInvisible

    private void jComboBoxMovementPopupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_jComboBoxMovementPopupMenuWillBecomeInvisible
        // TODO add your handling code here:
        //Code to enable appropriate fields based on movement data.
        DBA.openDBCon();

        String st = GetMovement();

        if(st.equals("10")){
            //Move to Lagering set fields.
            jComboBoxEmployee.setEnabled(true);
            jTextFieldTime.setEnabled(true);
            jDateChooser1.setEnabled(true);
            jComboBoxVessel.setEnabled(true);
            jTextFieldQty.setEnabled(true);
            jTextFieldGrav.setEnabled(true);
            jTextFieldTemp.setEnabled(true);
            jTextFieldPSI.setEnabled(false);
            jTextFieldNotes.setEnabled(true);
            jButtonLastGrav.setEnabled(true);
            jTextFieldHalf.setEnabled(false);
            jTextFieldQtr.setEnabled(false);
            jTextFieldSix.setEnabled(false);
            jTextField22.setEnabled(false);
            jTextField12.setEnabled(false);
            jTextField750.setEnabled(false);
            jButtonSubmit.setEnabled(true);
        }
        if(st.equals("15")){
            //Move to Conditioning set fields.
            jComboBoxEmployee.setEnabled(true);
            jTextFieldTime.setEnabled(true);
            jDateChooser1.setEnabled(true);
            jComboBoxVessel.setEnabled(true);
            jTextFieldQty.setEnabled(true);
            jTextFieldGrav.setEnabled(true);
            jTextFieldTemp.setEnabled(true);
            jTextFieldPSI.setEnabled(true);
            jTextFieldNotes.setEnabled(true);
            jButtonLastGrav.setEnabled(true);
            jTextFieldHalf.setEnabled(false);
            jTextFieldQtr.setEnabled(false);
            jTextFieldSix.setEnabled(false);
            jTextField22.setEnabled(false);
            jTextField12.setEnabled(false);
            jTextField750.setEnabled(false);
            jButtonSubmit.setEnabled(true);
        }
        if(st.equals("20")){
            //Move to Kegs set fields.
            jComboBoxEmployee.setEnabled(true);
            jTextFieldTime.setEnabled(false);
            jDateChooser1.setEnabled(true);
            jComboBoxVessel.setEnabled(false);
            jTextFieldQty.setEnabled(false);
            jTextFieldGrav.setEnabled(false);
            jTextFieldTemp.setEnabled(false);
            jTextFieldPSI.setEnabled(false);
            jTextFieldNotes.setEnabled(false);
            jButtonLastGrav.setEnabled(false);
            jTextFieldHalf.setEnabled(true);
            jTextFieldQtr.setEnabled(true);
            jTextFieldSix.setEnabled(true);
            jTextField22.setEnabled(false);
            jTextField12.setEnabled(false);
            jTextField750.setEnabled(false);
            jButtonSubmit.setEnabled(true);
        }
        if(st.equals("21")){
            //Move to Kegs set fields.
            jComboBoxEmployee.setEnabled(true);
            jTextFieldTime.setEnabled(false);
            jDateChooser1.setEnabled(true);
            jComboBoxVessel.setEnabled(false);
            jTextFieldQty.setEnabled(false);
            jTextFieldGrav.setEnabled(false);
            jTextFieldTemp.setEnabled(false);
            jTextFieldPSI.setEnabled(false);
            jTextFieldNotes.setEnabled(false);
            jButtonLastGrav.setEnabled(false);
            jTextFieldHalf.setEnabled(false);
            jTextFieldQtr.setEnabled(false);
            jTextFieldSix.setEnabled(false);
            jTextField22.setEnabled(true);
            jTextField12.setEnabled(true);
            jTextField750.setEnabled(true);
            jButtonSubmit.setEnabled(true);
        }
        if(st.equals("25")){
            //Move to Barrels set fields.
            jComboBoxEmployee.setEnabled(true);
            jTextFieldTime.setEnabled(true);
            jDateChooser1.setEnabled(true);
            jComboBoxVessel.setEnabled(false);
            jTextFieldQty.setEnabled(true);
            jTextFieldGrav.setEnabled(false);
            jTextFieldTemp.setEnabled(false);
            jTextFieldPSI.setEnabled(false);
            jTextFieldNotes.setEnabled(false);
            jButtonLastGrav.setEnabled(false);
            jTextFieldHalf.setEnabled(false);
            jTextFieldQtr.setEnabled(false);
            jTextFieldSix.setEnabled(false);
            jTextField22.setEnabled(false);
            jTextField12.setEnabled(false);
            jTextField750.setEnabled(false);
            jButtonSubmit.setEnabled(true);
        }

        //Set Movement info on label.
        DBA.GetStateData(st);
        jLabelMovement.setText(DBA.MoveDesc);

        DBA.closeDBCon();
    }//GEN-LAST:event_jComboBoxMovementPopupMenuWillBecomeInvisible

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MovementFrame().setVisible(true);
            }
        });
    }

    public void BrewPop(){
        jComboBoxMovement.setEnabled(true);
        DBA.openDBCon();

        String st = GetState();

        Movement.clear();

        if (st.equals("5")){
            //Primary fermentation need to show all options except packaging.
            Movement = DBA.RunSQLQuery("SELECT StateID,StateDesc,MoveDesc FROM State WHERE StateID ='10'" +
                    " OR StateID='25'");
        }
        if (st.equals("10")){
            //Lagering need to show all options except ferm and lagering..
            Movement = DBA.RunSQLQuery("SELECT StateID,StateDesc,MoveDesc FROM State WHERE StateID > 10");
        }
        if (st.equals("15")){
            //Conditioning need to show all options greater than 15..
            Movement = DBA.RunSQLQuery("SELECT StateID,StateDesc,MoveDesc FROM State WHERE StateID > 15");
        }
        if (st.equals("25")){
            //Barrel Aging need to show options 15, 20, and 21..
            Movement = DBA.RunSQLQuery("SELECT StateID,StateDesc,MoveDesc FROM State WHERE StateID='15'" +
                    " OR StateID='20' OR StateID='21'");
        }

        jComboBoxMovement.removeAllItems();
        jComboBoxMovement.addItem("");
        for(String s[] : Movement){
            jComboBoxMovement.addItem(s[2]);
        }

        //Update the appropriate ids for current vessel.
        String vs = GetVessel();
        if(vs.equals("69")){
            jLabelVessel.setText("Barrel");
            jLabelVessel2.setText("Barrel");
        } else {
            DBA.GetFVData(vs);
            jLabelVessel.setText(DBA.FVDesg);
            jLabelVessel2.setText(DBA.FVDesg);
        }

        //Update Batch.
        jLabelBatch.setText(GetBatch());
        jLabelGrav.setText(GetLastSG(GetBatch()));
        jLabelCurVol.setText(f.format(DBA.VolLeft) + " BBL");

        DBA.closeDBCon();
    }

    public String GetMovement(){
        for(String s[] : Movement){
            if(s[2].equals(jComboBoxMovement.getSelectedItem())){
                return s[0];
            }
        }
        return "0";
    }

    public String GetBatch(){
        //Look through brews, find selected value and determine its batch.
        //Ensure DB connection is open before calling.
        for(String s[] : Brew){
            DBA.GetBeerData(s[1]);
            DBA.GetStateData(s[2]);
            String disp = s[0] + ": " + DBA.BName + " - " + DBA.StateDesc;
            if(s[2].equals("5")) {
                DBA.GetFVData(s[3]);
                disp += " - " + DBA.FVDesg;
            }
            if(s[2].equals("10")) {
                DBA.GetFVData(s[4]);
                disp += " - " + DBA.FVDesg;
            }
            if(s[2].equals("15")) {
                DBA.GetFVData(s[5]);
                disp += " - " + DBA.FVDesg;
            }
            if(disp.equals(jComboBoxBrew.getSelectedItem())){
                return s[0];
            }
        }
        return "0";
    }

    public String GetState(){
        //Look through brews, find selected value and determine its state.
        //Ensure DB connection is open before calling.
        for(String s[] : Brew){
            DBA.GetBeerData(s[1]);
            DBA.GetStateData(s[2]);
            String disp = s[0] + ": " + DBA.BName + " - " + DBA.StateDesc;
            if(s[2].equals("5")) {
                DBA.GetFVData(s[3]);
                disp += " - " + DBA.FVDesg;
            }
            if(s[2].equals("10")) {
                DBA.GetFVData(s[4]);
                disp += " - " + DBA.FVDesg;
            }
            if(s[2].equals("15")) {
                DBA.GetFVData(s[5]);
                disp += " - " + DBA.FVDesg;
            }
            if(disp.equals(jComboBoxBrew.getSelectedItem())){
                return s[2];
            }
        }
        return "0";
    }

    public String GetVessel(){
        //Look through brews, find selected value and determine its state.
        //Ensure DB connection is open before calling.
        for(String s[] : Brew){
            DBA.GetBeerData(s[1]);
            DBA.GetStateData(s[2]);
            String disp = s[0] + ": " + DBA.BName + " - " + DBA.StateDesc;
            if(s[2].equals("5")) {
                DBA.GetFVData(s[3]);
                disp += " - " + DBA.FVDesg;
            }
            if(s[2].equals("10")) {
                DBA.GetFVData(s[4]);
                disp += " - " + DBA.FVDesg;
            }
            if(s[2].equals("15")) {
                DBA.GetFVData(s[5]);
                disp += " - " + DBA.FVDesg;
            }
            if(disp.equals(jComboBoxBrew.getSelectedItem())){
                if(s[2].equals("5")) return s[3];
                else if(s[2].equals("10")) return s[4];
                else if(s[2].equals("15")) return s[5];
                else return "69";
            }
        }
        return "0";
    }

    public String GetLastSG(String BatchID){
        DBA.GetBrewsData(BatchID);
        if (DBA.BTG > 1) return Float.toString(DBA.BTG);
        else if(DBA.SFGrav01 > 1) return Float.toString(DBA.SFGrav01);
        else if(DBA.YCGrav01 > 1) return Float.toString(DBA.YCGrav01);
        else if(DBA.DRGrav01 > 1) return Float.toString(DBA.DRGrav01);
        else if(DBA.PFGrav07 > 1) return Float.toString(DBA.PFGrav07);
        else if(DBA.PFGrav06 > 1) return Float.toString(DBA.PFGrav06);
        else if(DBA.PFGrav05 > 1) return Float.toString(DBA.PFGrav05);
        else if(DBA.PFGrav04 > 1) return Float.toString(DBA.PFGrav04);
        else if(DBA.PFGrav03 > 1) return Float.toString(DBA.PFGrav03);
        else if(DBA.PFGrav02 > 1) return Float.toString(DBA.PFGrav02);
        else if(DBA.PFGrav01 > 1) return Float.toString(DBA.PFGrav01);
        else return Float.toString(DBA.BOG);
    }

    public void SelectVes(String vid){
        DBA.openDBCon();

        for(String s[] : Brew){
            DBA.GetBeerData(s[1]);
            DBA.GetStateData(s[2]);
            String disp = s[0] + ": " + DBA.BName + " - " + DBA.StateDesc;
            if(s[2].equals("5")) {
                DBA.GetFVData(s[3]);
                disp += " - " + DBA.FVDesg;
            }
            if(s[2].equals("10")) {
                DBA.GetFVData(s[4]);
                disp += " - " + DBA.FVDesg;
            }
            if(s[2].equals("15")) {
                DBA.GetFVData(s[5]);
                disp += " - " + DBA.FVDesg;
            }

            if (s[0].equals(vid)) {
                jComboBoxBrew.setSelectedItem(disp);
                DBA.GetBrewsData(s[0]);
                DBA.GetRecipesData(Integer.toString(DBA.RID));
                
            }
        }

        DBA.closeDBCon();

        BrewPop();

        //SetData();
    }

    public void LoadList(){
        //Remove all existing items in combo boxes.
        jComboBoxBrew.removeAllItems();
        jComboBoxMovement.removeAllItems();
        jComboBoxEmployee.removeAllItems();
        jComboBoxVessel.removeAllItems();

        //Load combo boxes.
        DBA.openDBCon();

        //if (jCheckBoxBarrel.isSelected()){
        //    Brew = DBA.RunSQLQuery("SELECT BID,BBeerID,BState,PFVID,SFVID,CVID FROM Brews WHERE BState != 20 AND BState != 21");
        //} else {
            Brew = DBA.RunSQLQuery("SELECT BID,BBeerID,BState,PFVID,SFVID,CVID FROM Brews WHERE BState < 20");
        //}
        
        Movement = DBA.RunSQLQuery("SELECT StateID,StateDesc,MoveDesc FROM State WHERE StateID >= 10");
        Employee = DBA.RunSQLQuery("SELECT EmpID,EmpLastName,EmpFirstName FROM Employee");
        Vessel = DBA.RunSQLQuery("SELECT FVID,FVDesg FROM FV WHERE FVPRM='0'");
        Vesselold = DBA.RunSQLQuery("SELECT FVID,FVDesg FROM FV");

        jComboBoxBrew.addItem("");
        for(String s[] : Brew){
            DBA.GetBeerData(s[1]);
            DBA.GetStateData(s[2]);
            String disp = s[0] + ": " + DBA.BName + " - " + DBA.StateDesc;
            if(s[2].equals("5")) {
                DBA.GetFVData(s[3]);
                disp += " - " + DBA.FVDesg;
            }
            if(s[2].equals("10")) {
                DBA.GetFVData(s[4]);
                disp += " - " + DBA.FVDesg;
            }
            if(s[2].equals("15")) {
                DBA.GetFVData(s[5]);
                disp += " - " + DBA.FVDesg;
            }
            jComboBoxBrew.addItem(disp);

            jTextFieldHalf.setText("0");
            jTextFieldQtr.setText("0");
            jTextFieldSix.setText("0");
            jTextField22.setText("0");
            jTextField12.setText("0");
            jTextField750.setText("0");
        }

        jComboBoxMovement.addItem("");
        for(String s[] : Movement){
            jComboBoxMovement.addItem(s[2]);
        }

        jComboBoxEmployee.addItem("");
        for(String s[] : Employee){
            jComboBoxEmployee.addItem(s[2] + " " + s[1]);
        }

        jComboBoxVessel.addItem("");
        for(String s[] : Vessel){
            jComboBoxVessel.addItem(s[1]);
        }

        //Close Database Connection.
        DBA.closeDBCon();

        //Get todays date.
        java.util.Date dt = new java.util.Date();
        //java.sql.Date todaysdate = new java.sql.Date( dt.getTime());
        jDateChooser1.setDate(dt);

        //Disable all fields except the brew field.
        //Frame will enable depending on choices made to direct flow.
        jComboBoxMovement.setEnabled(false);
        jComboBoxEmployee.setEnabled(false);
        jTextFieldTime.setEnabled(false);
        jDateChooser1.setEnabled(false);
        jComboBoxVessel.setEnabled(false);
        jTextFieldQty.setEnabled(false);
        jTextFieldGrav.setEnabled(false);
        jTextFieldTemp.setEnabled(false);
        jTextFieldPSI.setEnabled(false);
        jTextFieldNotes.setEnabled(false);
        jButtonLastGrav.setEnabled(false);
        jTextFieldHalf.setEnabled(false);
        jTextFieldQtr.setEnabled(false);
        jTextFieldSix.setEnabled(false);
        jTextField22.setEnabled(false);
        jTextField12.setEnabled(false);
        jTextField750.setEnabled(false);
        jButtonSubmit.setEnabled(false);

    }

    @org.jdesktop.application.Action
    public void GetGrav() {
        DBA.openDBCon();
        jTextFieldGrav.setText(GetLastSG(GetBatch()));
        DBA.closeDBCon();
    }

    @org.jdesktop.application.Action
    public void ExitMovement() {
        dispose();
    }

    public boolean CheckFields(){
        boolean retval = true;

        //If field is enabled, then there should be a value.
        if(jComboBoxEmployee.isEnabled() && jComboBoxEmployee.getSelectedItem().toString().equals("")){
            retval = false;
        }
        if(jTextFieldTime.isEnabled() && jTextFieldTime.getText().equals("")){
            retval = false;
        }
        if(jComboBoxVessel.isEnabled() && jComboBoxVessel.getSelectedItem().toString().equals("")){
            retval = false;
        }
        if(jTextFieldQty.isEnabled() && jTextFieldQty.getText().equals("")){
            retval = false;
        }
        if(jTextFieldGrav.isEnabled() && jTextFieldGrav.getText().equals("")){
            retval = false;
        }
        if(jTextFieldTemp.isEnabled() && jTextFieldTemp.getText().equals("")){
            retval = false;
        }
        if(jTextFieldPSI.isEnabled() && jTextFieldPSI.getText().equals("")){
            retval = false;
        }
        if(jTextFieldHalf.isEnabled() && jTextFieldHalf.getText().equals("")){
            retval = false;
        }
        if(jTextFieldQtr.isEnabled() && jTextFieldQtr.getText().equals("")){
            retval = false;
        }
        if(jTextFieldSix.isEnabled() && jTextFieldSix.getText().equals("")){
            retval = false;
        }
        if(jTextField22.isEnabled() && jTextField22.getText().equals("")){
            retval = false;
        }
        if(jTextField12.isEnabled() && jTextField12.getText().equals("")){
            retval = false;
        }
        if(jTextField750.isEnabled() && jTextField750.getText().equals("")){
            retval = false;
        }

        return retval;
    }

    @org.jdesktop.application.Action
    public void SubmitMovement() {
        int response = JOptionPane.showConfirmDialog(null,
                "This will submit this movement to the database, Continue? ",
                "Warning",JOptionPane.WARNING_MESSAGE);
        if (response == 0){
            //Check if all required values are loaded.
            boolean check = CheckFields();
            if(check == false){
                JOptionPane.showMessageDialog(null,
                        "Please enter in ALL required information",
                        "Error", JOptionPane.ERROR_MESSAGE);
                return;
            }

            DBA.openDBCon();

             //Determine type of movement.
            String st = GetMovement();

            //Get Brew Batch Number.
            String BrewID = jLabelBatch.getText();

            //Get Date
            java.util.Date dte = jDateChooser1.getDate();
            java.sql.Date MoveDate = new java.sql.Date( dte.getTime() );

            //Get Employee ID
            String EmpID = "0";
            for(String s[] : Employee){
                if((s[2] + " " + s[1]).equals(jComboBoxEmployee.getSelectedItem().toString())){
                    EmpID = s[0];
                }
            }

            //Get New Vessel ID if any.
            String NVID = "0";
            if(jComboBoxVessel.isEnabled()){
                for(String s[] : Vessel){
                    if(s[1].equals(jComboBoxVessel.getSelectedItem().toString())){
                        NVID = s[0];
                    }
                }
            }

            //Get Old Vessel ID
            String OVID = jLabelVessel2.getText();
            for(String s[] : Vesselold){
                if(s[1].equals(jLabelVessel2.getText())){
                    OVID = s[0];
                }
            }

            //GetNewState
            String NewState = "0";
            for(String s[] : Movement){
                if(s[2].equals(jComboBoxMovement.getSelectedItem().toString())){
                    NewState = s[0];
                }
            }

            if(st.equals("10")){
                //Movement from Fermentation to a brite tank. (Lager)
                //Insert Movement Values into Movement table.

                //Fill in fields.
                String fields = "MovementDate,MovementBrewID,MovementOldState,MovementStateID,MovementVolume" +
                        ",MovementEmpID,MovementNotes,MovementOVID,MovementNVID";
                //Fill in query values.
                String query = "'" +
                    MoveDate + "','" +
                    BrewID + "','" +
                    GetState() + "','" +
                    NewState + "','" +
                    jTextFieldQty.getText() + "','" +
                    EmpID + "','" +
                    jTextFieldNotes.getText() + "','" +
                    OVID + "','" +
                    NVID + "'";
                //Insert new data.
                DBA.RunSQLInsertQuery("Movement",fields,query);

                //Update Brew Log Information.
                //Start query statemetn.
                String query1 = "UPDATE Brews SET ";
                query1 += ("BState='" + NewState + "'");
                query1 += (" ,SFTemp01='" + jTextFieldTemp.getText() + "'");
                query1 += (" ,SFGrav01='" + jTextFieldGrav.getText() + "'");
                query1 += (" ,SFDate01='" + MoveDate + "'");
                query1 += (" ,SFTime01='" + jTextFieldTime.getText() + "'");
                query1 += (" ,SFNote01='" + jTextFieldNotes.getText() + "'");
                query1 += (" ,SFVol01='" + jTextFieldQty.getText() + "'");
                query1 += (" ,SFVID='" + NVID + "'");
                query1 += (" ,VolLeft='" + jTextFieldQty.getText() + "'");
                query1 += " WHERE BID = '" + BrewID + "'";
                //Run Query.
                DBA.RunSQLUpdateQuery(query1);
            }
            if(st.equals("15")){
                //Movement from Brite to a brite tank. (Condition.)
                //Insert Movement Values into Movement table.

                //Fill in fields.
                String fields = "MovementDate,MovementBrewID,MovementOldState,MovementStateID,MovementVolume" +
                        ",MovementEmpID,MovementNotes,MovementOVID,MovementNVID";
                //Fill in query values.
                String query = "'" +
                    MoveDate + "','" +
                    BrewID + "','" +
                    GetState() + "','" +
                    NewState + "','" +
                    jTextFieldQty.getText() + "','" +
                    EmpID + "','" +
                    jTextFieldNotes.getText() + "','" +
                    OVID + "','" +
                    NVID + "'";
                //Insert new data.
                DBA.RunSQLInsertQuery("Movement",fields,query);

                //Update Brew Log Information.
                //Start query statemetn.
                String query1 = "UPDATE Brews SET ";
                query1 += ("BState='" + NewState + "'");
                query1 += (" ,BTG='" + jTextFieldGrav.getText() + "'");
                query1 += (" ,CTDate='" + MoveDate + "'");
                query1 += (" ,CTTime='" + jTextFieldTime.getText() + "'");
                query1 += (" ,BPSI='" + jTextFieldPSI.getText() + "'");
                query1 += (" ,CTTemp='" + jTextFieldTemp.getText() + "'");
                query1 += (" ,CTVol='" + jTextFieldQty.getText() + "'");
                query1 += (" ,CVID='" + NVID + "'");
                query1 += (" ,VolLeft='" + jTextFieldQty.getText() + "'");
                query1 += " WHERE BID = '" + BrewID + "'";
                //Run Query.
                DBA.RunSQLUpdateQuery(query1);
            }
            if(st.equals("20")){
                //Movement from Brite to Kegs. (Kegging)
                
                //Get BeerID based on brews id.
                DBA.GetBrewsData(BrewID);
                String BeerID = Integer.toString(DBA.BBeerID);

                //Get Beer Data.
                DBA.GetBeerData(BeerID);

                //Calculate total volume kegged.
                float totalv = (Float.valueOf(jTextFieldHalf.getText().trim()).floatValue()/2);
                totalv += (Float.valueOf(jTextFieldQtr.getText().trim()).floatValue()/4);
                totalv += (Float.valueOf(jTextFieldSix.getText().trim()).floatValue()/6);

                //Calculate total volume left in tank.
                float newvol = DBA.VolLeft - totalv;
                if(newvol < 0) newvol=0;

                //Update Brew Log Information.
                //Start query statemetn.
                String query1 = "UPDATE Brews SET ";
                query1 += ("PDate='" + MoveDate + "'");
                query1 += (" ,PTime='" + jTextFieldTime.getText() + "'");
                if(newvol <= 1.90){
                    query1 += (" ,BState='20'");
                    query1 += (" ,VolLeft='0'");
                } else {
                    query1 += (" ,VolLeft='" + Float.toString(newvol) + "'");
                }
                query1 += " WHERE BID = '" + BrewID + "'";
                //Run Query.
                DBA.RunSQLUpdateQuery(query1);

                //Insert the data into the Movement log.
                //Fill in fields.
                String fields = "MovementDate,MovementBrewID,MovementOldState,MovementStateID,MovementVolume" +
                        ",MovementEmpID,MovementOVID";
                //Fill in query values.
                String query = "'" +
                    MoveDate + "','" +
                    BrewID + "','" +
                    GetState() + "','" +
                    NewState + "','" +
                    f.format(totalv) + "','" +
                    EmpID + "','" +
                    OVID + "'";
                //Insert new data.
                DBA.RunSQLInsertQuery("Movement",fields,query);

                //Update Beer Inventory.
                if(DBA.DoesValueExist("BeerInventory","BIBId",BeerID)){
                    //Beer is already entered into the inventory, just update.
                    String BIID = DBA.ReturnKey("BeerInventory", "BIBId", BeerID, "BIId");

                    //Get Beer Inventory Data
                    DBA.GetBeerInventoryData(BIID);

                    //Calculate new totals.
                    int newHalf = DBA.BIHalf + Integer.parseInt(jTextFieldHalf.getText());
                    int newQtr = DBA.BIQtr + Integer.parseInt(jTextFieldQtr.getText());
                    int newSix = DBA.BISix + Integer.parseInt(jTextFieldSix.getText());

                    //Update Brew Inventory Information.
                    //Start query statemetn.
                    String query2 = "UPDATE BeerInventory SET ";
                    query2 += ("BIHalf='" + newHalf + "'");
                    query2 += (" ,BIQtr='" + newQtr + "'");
                    query2 += (" ,BISix='" + newSix + "'");
                    query2 += " WHERE BIId = '" + BIID + "'";
                    //Run Query.
                    DBA.RunSQLUpdateQuery(query2);
                    
                    //Display previous values and new value in pop up window.
                    JOptionPane.showMessageDialog(null,
                        "Added Following Information To Inventory: \n" +
                        "Beer: " + DBA.BName + "\n" +
                        "Half: " + Integer.toString(newHalf) + "\n" +
                        "Qtr: " + Integer.toString(newQtr) + "\n" +
                        "Six: " + Integer.toString(newSix) + "\n");
                } else {
                    //Beer is new, we need to create a new entry.
                    //Insert the data into the Movement log.
                    //Fill in fields.
                    String fields1 = "BIBId,BIHalf,BIQtr,BISix";
                    //Fill in query values.
                    String query4 = "'" +
                        BeerID + "','" +
                        Integer.parseInt(jTextFieldHalf.getText()) + "','" +
                        Integer.parseInt(jTextFieldQtr.getText()) + "','" +
                        Integer.parseInt(jTextFieldSix.getText()) + "'";
                    //Insert new data.
                    DBA.RunSQLInsertQuery("BeerInventory",fields1,query4);

                    DBA.GetBeerInventoryData(BeerID);

                    //Display previous values and new value in pop up window.
                    JOptionPane.showMessageDialog(null,
                        "Added Following Information To Inventory: \n" +
                        "Beer: " + DBA.BName + "\n" +
                        "Half: " + Integer.toString(DBA.BIHalf) + "\n" +
                        "Qtr: " + Integer.toString(DBA.BIQtr) + "\n" +
                        "Six: " + Integer.toString(DBA.BISix) + "\n");
                }
            }
            if(st.equals("21")){
                //Movement from Brite to Bottles. (Bottling)
                
                //Get BeerID based on brews id.
                DBA.GetBrewsData(BrewID);
                String BeerID = Integer.toString(DBA.BBeerID);

                //Get Beer Data.
                DBA.GetBeerData(BeerID);

                //Calculate total volume kegged.
                double totalv = 0;
                if(!jTextField22.getText().equals(""))
                    totalv += ((Double.parseDouble(jTextField22.getText())*0.171875)/31);
                if(!jTextField12.getText().equals(""))
                    totalv += ((Double.parseDouble(jTextField12.getText())*0.09375)/31);
                if(!jTextField750.getText().equals(""))
                    totalv += ((Double.parseDouble(jTextField750.getText())*0.198129139)/31);

                
                //Calculate total volume left in tank.
                double newvol = DBA.VolLeft - totalv;
                if(newvol < 0) newvol=0;

                //Update Brew Log Information.
                //Start query statemetn.
                String query1 = "UPDATE Brews SET ";
                query1 += ("PDate='" + MoveDate + "'");
                if(newvol <= 1.90){
                    query1 += (" ,VolLeft='0'");
                    query1 += (" ,BState='21'");
                } else {
                    query1 += (" ,VolLeft='" + f.format(newvol) + "'");
                }
                query1 += " WHERE BID = '" + BrewID + "'";
                //Run Query.
                DBA.RunSQLUpdateQuery(query1);


                //Insert the data into the Movement log.
                //Fill in fields.
                String fields = "MovementDate,MovementBrewID,MovementOldState,MovementStateID,MovementVolume" +
                        ",MovementEmpID,MovementOVID";
                //Fill in query values.
                String query = "'" +
                    MoveDate + "','" +
                    BrewID + "','" +
                    GetState() + "','" +
                    NewState + "','" +
                    f.format(totalv) + "','" +
                    EmpID + "','" +
                    OVID + "'";
                //Insert new data.
                DBA.RunSQLInsertQuery("Movement",fields,query);

                //Update Beer Inventory.
                if(DBA.DoesValueExist("BeerInventory","BIBId",BeerID)){
                    //Beer is already entered into the inventory, just update.
                    String BIID = DBA.ReturnKey("BeerInventory", "BIBId", BeerID, "BIId");

                    //Get Beer Inventory Data
                    DBA.GetBeerInventoryData(BIID);

                    int new22 = 0;
                    int new12 = 0;
                    int new750 = 0;

                    //Calculate new totals.
                    if(!jTextField22.getText().equals(""))
                        new22 = DBA.BITT + Integer.parseInt(jTextField22.getText());
                    if(!jTextField12.getText().equals(""))
                        new12 = DBA.BITW + Integer.parseInt(jTextField12.getText());
                    if(!jTextField750.getText().equals(""))
                        new750 = DBA.BISF + Integer.parseInt(jTextField750.getText());

                    //Update Brew Inventory Information.
                    //Start query statemetn.
                    String query2 = "UPDATE BeerInventory SET ";
                    query2 += ("BITT='" + new22 + "'");
                    query2 += (" ,BITW='" + new12 + "'");
                    query2 += (" ,BISF='" + new750 + "'");
                    query2 += " WHERE BIId = '" + BIID + "'";
                    //Run Query.
                    DBA.RunSQLUpdateQuery(query2);
                    
                    //Display previous values and new value in pop up window.
                    JOptionPane.showMessageDialog(null,
                        "Added Following Information To Inventory: \n" +
                        "Beer: " + DBA.BName + "\n" +
                        "22 Oz.: " + Integer.toString(new22) + "\n" +
                        "12 Oz.: " + Integer.toString(new12) + "\n" +
                        "750 mL: " + Integer.toString(new750) + "\n");
                } else {
                    //Beer is new, we need to create a new entry.
                    //Insert the data into the Movement log.
                    //Fill in fields.
                    String fields1 = "BIBId,BITT,BITW,BISF";
                    //Fill in query values.
                    String query4 = "'" +
                        BeerID + "','" +
                        Integer.parseInt(jTextField22.getText()) + "','" +
                        Integer.parseInt(jTextField12.getText()) + "','" +
                        Integer.parseInt(jTextField750.getText()) + "'";
                    //Insert new data.
                    DBA.RunSQLInsertQuery("BeerInventory",fields1,query4);

                    DBA.GetBeerInventoryData(BeerID);

                    //Display previous values and new value in pop up window.
                    JOptionPane.showMessageDialog(null,
                        "Added Following Information To Inventory: \n" +
                        "Beer: " + DBA.BName + "\n" +
                        "22 Oz.: " + Integer.toString(DBA.BITT) + "\n" +
                        "12 Oz.: " + Integer.toString(DBA.BITW) + "\n" +
                        "750 mL: " + Integer.toString(DBA.BISF) + "\n");
                }
            }
            if(st.equals("25")){
                //Movement from Vessel to Barrel. (Barrel Aging)
                //Get BeerID based on brews id.
                DBA.GetBrewsData(BrewID);
                String BeerID = Integer.toString(DBA.BBeerID);

                //Get Beer Data.
                DBA.GetBeerData(BeerID);

                float NewVol = DBA.VolLeft - Float.valueOf(jTextFieldQty.getText().trim()).floatValue();
                if(NewVol < 0) NewVol=0;

                //Insert the data into the Movement log.
                //Fill in fields.
                String fields = "MovementDate,MovementBrewID,MovementOldState,MovementStateID,MovementVolume" +
                        ",MovementEmpID,MovementOVID";
                //Fill in query values.
                String query = "'" +
                    MoveDate + "','" +
                    BrewID + "','" +
                    GetState() + "','" +
                    NewState + "','" +
                    jTextFieldQty.getText() + "','" +
                    EmpID + "','" +
                    OVID + "'";
                //Insert new data.
                DBA.RunSQLInsertQuery("Movement",fields,query);

                //Update Brew Log Information.
                //Start query statemetn.
                String query1 = "UPDATE Brews SET ";
                if(NewVol <= 1.90){
                    query1 += ("VolLeft='0'");
                    query1 += (" ,BState='25'");
                } else {
                    query1 += ("VolLeft='" + Double.toString(NewVol) + "'");
                }
                query1 += " WHERE BID = '" + BrewID + "'";
                //Run Query.
                DBA.RunSQLUpdateQuery(query1);

                //Insert info into Barrel Aging Database.
                //Insert the data into the Movement log.
                //Fill in fields.
                String fields1 = "BADate,BABrew,BAVol,BANotes";
                //Fill in query values.
                String query4 = "'" +
                    MoveDate + "','" +
                    BrewID + "','" +
                    jTextFieldQty.getText() + "','" +
                    jTextFieldNotes.getText() + "'";
                //Insert new data.
                DBA.RunSQLInsertQuery("BarrelAging",fields1,query4);
            }

            DBA.closeDBCon();

            LoadList();
        }
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonExit;
    private javax.swing.JButton jButtonLastGrav;
    private javax.swing.JButton jButtonSubmit;
    private javax.swing.JComboBox jComboBoxBrew;
    private javax.swing.JComboBox jComboBoxEmployee;
    private javax.swing.JComboBox jComboBoxMovement;
    private javax.swing.JComboBox jComboBoxVessel;
    private com.toedter.calendar.JDateChooser jDateChooser1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabelBatch;
    private javax.swing.JLabel jLabelCurVol;
    private javax.swing.JLabel jLabelGrav;
    private javax.swing.JLabel jLabelMovement;
    private javax.swing.JLabel jLabelVessel;
    private javax.swing.JLabel jLabelVessel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanelBarrel;
    private javax.swing.JPanel jPanelCellar;
    private javax.swing.JPanel jPanelInfo;
    private javax.swing.JPanel jPanelStats;
    private javax.swing.JTextField jTextField12;
    private javax.swing.JTextField jTextField22;
    private javax.swing.JTextField jTextField750;
    private javax.swing.JTextField jTextFieldGrav;
    private javax.swing.JTextField jTextFieldHalf;
    private javax.swing.JTextField jTextFieldNotes;
    private javax.swing.JTextField jTextFieldPSI;
    private javax.swing.JTextField jTextFieldQtr;
    private javax.swing.JTextField jTextFieldQty;
    private javax.swing.JTextField jTextFieldSix;
    private javax.swing.JTextField jTextFieldTemp;
    private javax.swing.JTextField jTextFieldTime;
    // End of variables declaration//GEN-END:variables

}
